package com.itgaoshu.service.impl;

import com.itgaoshu.bean.SysUser;
import com.itgaoshu.mapper.SysUserMapper;
import com.itgaoshu.service.SysUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: xiyue
 * Date: 2021/3/19
 * Time: 19:04
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
@Transactional
public class SysUserServciceImpl implements SysUserService {
    //创建mapper层对象
    @Resource
    private SysUserMapper userMapper;
    //查询所有用户
    @Override
    public List<SysUser> selectAllUsers() {
        return userMapper.selectAll();
    }

    //查询用户是否经存在
    @Override
    public int checkUser(String loginname) {
        return userMapper.checkUser(loginname);
    }

    //添加用户
    @Override
    public int addUser(SysUser user) {
        int result = userMapper.insert(user);
        return 0;
    }
    //通过id删除用户
    @Override
    public int deleteUserById(Integer userid) {
        return userMapper.deleteUserById(userid);
    }
    //用户修改
    @Override
    public int updateUser(SysUser user) {
        return userMapper.updateUser(user);
    }



}
